package cn.distribution.receiptManager.service;

import cn.distribution.receiptManager.entity.dao.ReceiptDAO;
import cn.distribution.receiptManager.entity.vo.ReceiptVO;
import cn.distribution.receiptManager.mapper.ReceiptMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author zhengminjie
 */
@Service
public class ReceiptService extends ServiceImpl<ReceiptMapper, ReceiptDAO> {

    @Resource
    private ReceiptMapper receiptMapper;

    /**
     * 通过项目id得到office_id和office名
     */
    public List<ReceiptVO> getIdName(Long projectId){
        return receiptMapper.getIdName(projectId);
    }

    /**
     * 通过项目id,officeId得到分发人数
     */
    public Long sendCount(Long officeId, Long projectId){
        return receiptMapper.sendCount(officeId, projectId);
    }

    /**
     * 通过项目id,officeId得到未读人数
     */
    public Long unReadCount(Long officeId, Long projectId){
        return receiptMapper.unReadCount(officeId, projectId);
    }

    /**
     * 通过项目id,officeId得到同意人数
     */
    public Long agreeCount(Long officeId, Long projectId){
        return receiptMapper.agreeCount(officeId, projectId);
    }

    /**
     * 通过项目id,officeId得到拒绝人数
     */
    public Long refuseCount(Long officeId, Long projectId){
        return receiptMapper.refuseCount(officeId, projectId);
    }

    /**
     * 通过发送人id获取发件信息列表
     */
    public List<ReceiptVO> getDataList(Long sendId){
        return this.receiptMapper.getDataList(sendId);}
    /**
     * 通过关键词日期查找列表
     */
    public List<ReceiptVO> searchDataList(Long sendId, String officeName, Date beginTime, Date endTime)
    {return this.receiptMapper.searchDataList(sendId,officeName,beginTime,endTime);}

    /**
     * 获得收件信息列表
     */
    public List<ReceiptVO> getReceiptList(Long receiptId, String officeName, Date beginTime, Date endTime)
    {return this.receiptMapper.getReceiptList(receiptId,officeName,beginTime,endTime);}

    public Long deleteOffice( Long Id){
        return this.receiptMapper.deleteOffice(Id);
    }

}
